<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
    <script src="/html/jquery-3.2.1.min.js"></script>
    <script>
        function getObj() {
            $.ajax({
               url:"/ajax/getUser",
               type:"GET",
                //以json格式接收服务器数据，
                //这样回调函数中的info就是json对象
                dataType:"json",
               success:function(info){
                   $("#idSpan").html(info.id);
                   $("#nameSpan").html(info.name);
                   $("#birthdaySpan").html(info.birthday);
                   $("#telTxt").val(info.tel);
               }
            });
        }

        function getList() {
            $.post("/ajax/findAll",null,function (info) {
                //将对象转化为json字符串
                // alert(JSON.stringify(info));

                let dataStr = "";
                for(let i=0;i<info.length;i++){
                    var obj = info[i];
                    dataStr += `<tr><td>${obj.name}</td><td>${obj.birthday}</td><td>${obj.tel}</td></tr>`;
                }
                $("#data").html(dataStr);

            },"json");
        }
    </script>
</head>
<body>
    编号：<span id="idSpan"></span><br>
    姓名：<span id="nameSpan"></span><br>
    生日：<span id="birthdaySpan"></span><br>
    电话：<input type="text" id="telTxt"><br>
    <input type="button" value="得到用户信息" onclick="getObj()"><br>

    <input type="button" value="得到表格信息" onclick="getList()">
    <table border="1" width="60%">
        <thead><tr><th>姓名</th><th>生日</th><th>电话</th></tr></thead>

        <tbody id="data"></tbody>
    </table>
</body>
</html>